#!/bin/bash

set -x

ulimit -l unlimited


pool='test-pool'

duration=180
#rules=({mem,pmem,nvme}_rule)
rules=(pmem_rule)
#block_sizes=(256 512 1K 4K 1M)
block_sizes=(1M)
concurrencies=(1 16 128)


cat /etc/ceph/ceph.conf
echo

for rule in ${rules[@]}; do
	bin/ceph osd pool create ${pool} 128 ${rule}
	bin/ceph osd pool set ${pool} pg_autoscale_mode warn
	sleep 10
	for bs in ${block_sizes[@]}; do
		for numjob in ${concurrencies[@]}; do
			echo "======== ${rule} -b=${bs} -O=${bs} -t=${numjob} ========"
			rados -p ${pool} -b ${bs} -O ${bs} bench ${duration} write -t ${numjob} --no-cleanup
			rados -p ${pool} bench ${duration} seq -t ${numjob}
			rados -p ${pool} bench ${duration} rand -t ${numjob}
			rados -p ${pool} cleanup
			echo
			sleep 10
		done
	done
	bin/ceph osd pool delete ${pool} ${pool} --yes-i-really-really-mean-it
done
